/**
 * @author Hoang
 */
function ProductModel() {
	this.parent();
}

ProductModel.inherits(BaseModel, {
	
});

var Book = function(books) {
	this.books = books;
}

function createProductModel (book) {
		var books = book.getElementsByTagName("book");
		var author, bookId, bookName, categoryId, count, des, price, quan, imgUrl;
		var arrBook = [];
		for (var i = 0; i < books.length; i++) {
			author = books[i].getElementsByTagName("author")[0].childNodes[0].nodeValue;
			bookId = books[i].getElementsByTagName("bookId")[0].childNodes[0].nodeValue;
			bookName = books[i].getElementsByTagName("bookName")[0].childNodes[0].nodeValue;
			categoryId = books[i].getElementsByTagName("categoryId")[0].childNodes[0].nodeValue;
			count = books[i].getElementsByTagName("count")[0].childNodes[0].nodeValue;
			des = books[i].getElementsByTagName("description")[0].childNodes[0].nodeValue;
			price = books[i].getElementsByTagName("price")[0].childNodes[0].nodeValue;
			quan = books[i].getElementsByTagName("quantity")[0].childNodes[0].nodeValue;
			imgUrl = books[i].getElementsByTagName("picture")[0].childNodes[0].nodeValue;
			arrBook[i] = {
				"bookId" : bookId,
				"author" : author,
				"bookName" : bookName,
				"categoryId" : categoryId,
				"count" : count,
				"des" : des,
				"price" : price,
				"quan" : quan,
				"imgUrl" : imgUrl
			};
		}

		return new Book(arrBook);

	}